<template>
    <div class="day column" @click="setActiveDay(day.id)">
        <div class="day-banner has-text-centered">{{day.abbvTitle}}</div>
        <div class="day-details">
            <div class="day-number">{{day.id}}</div>
            <calendar-event
                v-for="(event,index) in day.events"
                :key="index"
                :event="event"
                :day="day"></calendar-event>
        </div>
    </div>
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator'
import { CalendarDetail } from '@/components/calendarDetail'
import CalendarEvent from '@/components/CalendarEvent.vue'


@Component({
    components: { CalendarEvent }
})
export default class CalendarDay extends Vue {
    name = 'CalendarDay'
    @Prop()
    day!: CalendarDetail;

    private setActiveDay(dayId:number){
        this.$store.commit("setActiveDay",dayId);
    }
}
</script>

<style lang="scss" scoped>
.day {
    background-color: #4A4A4A;
    color: #FFF;
    border-left: 1px solid #8F8F8F;
    border-bottom: 1px solid #8F8F8F;
    font-size: 12px;
    cursor: pointer;

    &:hover {
        background: darken(#4A4A4A, 3%);
    }

    .day-banner {
        background-color: #333333;
        color: #FFF;
        padding: 10px;
        text-transform: uppercase;
        letter-spacing: 1px;
        font-size: 12px;
        font-weight: 600;
    }

    .day-details {
        padding: 10px;
    }

    &:last-child {
        border-right: 1px solid #8F8F8F;
    }

    .day-event {
        margin-top: 6px;
        margin-bottom: 6px;
        display: block;
        color: #4C4C4C;
        padding: 5px;

        .details {
            display: block;
        }

        .icons .fa {
            padding: 0 2px;
        }

        input {
            background: none;
            border: 0;
            border-bottom: 1px solid #FFF;
            width: 100%;

            &:focus {
                outline: none;
            }
        }
    }
}
</style>
